// 病人账户管理
import React from 'react';
import moment from 'moment';
import { Select, Input, Row, Col, Button, Spin, Divider, Popconfirm, message, Icon, Form, DatePicker, Table, Tabs, Modal } from 'antd';
import { $http } from 'containers/config/https';
import './style/style.less'
import TipHeader from './component/TipHeader'
import HopNumber from './component/HopNumber'
import { Keup, ArraySome, dayFormat } from '../../../tools/index';
import { $loadTemplate } from '../../lodop/Common/Print.js';
import ReadCard from '../../../components/readcard/ReadCard';
import RangeDatePicker from 'components/rangePicker/index';
import store from '../../../store';
import CommonPagination from 'components/pagination/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';

// 组件const
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const { Search } = Input;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 14, offset: 2 },
};
class PatientAccountManagementIP extends React.Component {
    constructor(props) {
        super(props)
        var date = new Date()
        this.state = {
            dataPatChar: [], //账户管理table数据
            tableData: [], // 账户管理table数据
            cardTypeData: [], // 卡类型
            cardType: '', // 卡类型
            userInfo: {},
            patNo: '', // 登记号
            cardNo: '', // 卡号
            cardType: '', // 卡类型
            // 表格数据
            // 表格数据总条数
            total: 0,
            showLoading: true,
            page: 1,
            pageSize: 10,
            subAccManagementID: '',
            findFlag: '4',
            endDate: moment(date).format(dayFormat),
            startDate: moment(date).format(dayFormat),
            doType: '4',
            modalShow: false,
            modalShowNumber: false,
            modalPayTitle: '',
            payButtonNum: 0,
            modalType: '',
            accmanID: '',							//账户ID
            patID: '',						//Pat_Dr 病人ID			       
            accAbleReturn: 0,
            accBlance: 0,
            accDPAllPayAmt: 0,
            accStatusDesc: '—',
            accTSubIDL: '',
            modalWidth: '600px',
            otherPayData: [],
            payotherID: '', //支付方式ID 充值
            rechargeMoney: '0.00', //缴款金额 缴款金额
            rechargeReceipts: '0.00', // 实收
            rechargeGive: '0.00', // 找零
            rechargeMark: '',  //备注 保存备注信息(支票号、银行卡(号)等) 充值
            reasonsRefundType: '', // 退费原因
            reasonsRefundData: [], // 退费原因
            refundAmount: '',// 提交 退款金额
            refundChannel: '', // 提交 退款渠道
            refundRemarks: '', //  退费备注
            refundGive: '0.00', // 退款找零

            originaPassword: '',
            confirmPassword: '', //输入确认密码
            newPassword: '', //输入新密码
            IsSame: false, //是否显示新密码与确认密码一致信息标志

            languageTable1: {}, // 国际化Table1
            languageTable2: {}, // 国际化Table2
            languageData: {}, // 国际化语言包
            language: {},   // 国际化语言
            languageCode: JSON.parse(window.sessionStorage.userData).language, // 国际化语言标识
            columns: [],
            readModeI: true,
            readModeR: true,
            accDID: '',
            invoice: '', // 发票
            accPurpose: [], // 账户用途
            accPurposeCode: "",// 用途代码
            purposeBlance: '', //用途余额
            admList: [], //就诊列表
            admID: '', //就诊ID
            patTotal: 0,  //就诊总数
            patShowLoading: true, //就诊列表加载状态
            patPage: 1, //就诊页码
            patPageSize: 10,//每页数量
            patColumns: [], //患者表格列头
            admID: '',
            ifAdmFlag: '',      // 是否按就诊计算
        }


        // // 账户管理table
        // this.columns = [{
        //     title: '医院名称',
        //     dataIndex: 'hospName',
        //     key: '1',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '流水号',
        //     dataIndex: 'accDPTradNo',
        //     key: '2',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '时间',
        //     dataIndex: 'accDPDateTime',
        //     key: '3',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '交易类型',
        //     dataIndex: 'operateType',
        //     key: '11',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '金额',
        //     dataIndex: 'accDPPayAmt',
        //     key: '4',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '支付渠道',
        //     dataIndex: 'payWayDesc',
        //     key: '5',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '操作员',
        //     dataIndex: 'accDPPayUserName',
        //     key: '7',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '当前账户余额',
        //     dataIndex: 'accDPSubBalance',
        //     key: '8',
        //     align: "center",
        //     width: 200,
        // }, {
        //     title: '备注',
        //     dataIndex: 'note',
        //     key: '10',
        //     align: "center",
        //     width: 200,
        // },]
    }

    componentDidMount() {
        this.tableList("PatientAccountManagement", "PatientAccountManagement", "columns");
        this.tableList("", "AccManageIP", "patColumns");
        this.initJuris() //权限
        this.cardTypeList() //卡类型
        this.reasonsRefund() //退费原因
        this.getAccPurPoseSelectData(); // 用途下拉数据
        // 数据加载成功关闭loading
        //this.child.handleLoading()
        if (this.props.number && this.props.number != '') {
            this.setState({
                patNo: this.props.number || ''
            }, () => {
                this.searchUser()  //查询
            })
        }
        let depositType = "";

        if (this.props.location) {
            if (this.props.location.state) {
                depositType = this.props.location.state.depositType ? this.props.location.state.depositType : "";
            }

        } else {
            if (this.props.paras) {
                depositType = this.props.paras.depositType ? this.props.paras.depositType : "";
            } else {
                depositType = this.props.depositType ? this.props.depositType : "";
            }

        }
        if (depositType === "") return
        this.setState({
            depositType: depositType,
        })

    }
    // 获取庄户用途下拉数据
    getAccPurPoseSelectData = () => {
        let data = {
            params: [{
                "type": "I"
            }]
        }
        $http.post('urlS', this, {
            code: '05100355',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let accPurpose = res.result.data
                    this.setState({ accPurpose })
                }
            }
        })
    }
    // 账户用途修改
    onPurposeChange = (val, opt) => {
        let { accmanID, admID } = this.state;
        this.setState({
            accPurposeCode: val,
            refundAmount: '',
            refundGive: '0.00',
            ifAdmFlag: opt.props.ifAdmFlag
        }, () => {
            this.getPurposeBlance();
        })
    }
    // 获取账户用途金额
    getPurposeBlance = () => {
        let {accmanID, accPurposeCode} = this.state
        let data = {
            params: [{
                accmanID: accmanID,
                puposeCode: accPurposeCode,
            }]
        }

        $http.post('urlADS', this, {
            code: "03040039",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    this.setState({
                        purposeBlance: res.purposeBlance,
                    })
                }
            }
        });
    }   
    /* 设置input获得焦点 */
    setInputFocus = (currentInput) => {
        let { input } = currentInput;
        input.focus();
    }

    onColumnRef = (ref) => {
        this.columnRef = ref;
    }
    // 获取主列表columns
    tableList = (reactCode, compontName, colums) => {
        var data = {
            params: [{
                "reactCode": [reactCode],
                "compontName": compontName,
                "type": "C"
            }]
        }
        $http.post('urlS', this, {
            code: '01040073',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let resC = res.result.C
                    let { languageCode } = this.state
                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }
                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                            display: item.display,
                            key: item.seqNo
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    if (reactCode != "") {
                        this.setState({
                            [colums]: filterArr,
                            languageTable1: res.result.B || {},  // 国际化Table1
                            languageTable2: res.result.C || {},  // 国际化Table2
                            languageData: res.result.language || {},  // 国际化语言包
                        }, () => {
                            this.LanCNEN(this.state.languageCode)
                        })
                    } else {
                        this.setState({
                            [colums]: filterArr,
                        })
                    }

                }
            }
        })
    }

    LanCNEN = (code) => {
        let { languageData } = this.state
        this.setState({
            language: languageData[code]
        })
    }

    // 页码改变的回调，参数是改变后的页码及每页条数
    appPageChange = (flag, page, pageSize) => {
        if (flag) {
            this.setState({
                patPage: page,
                patPageSize: pageSize,
            }, () => {
                // 重新调用查询方法
                this.queryAdmList();
            });
        } else {
            this.setState({
                page: page,
                pageSize: pageSize,
            }, () => {
                // 重新调用查询方法
                this.handleQuery();
            });
        }
    }

    // 条数改变的回调
    apponShowSizeChange = (flag, current, size) => {
        if (flag) {
            this.setState({
                patPage: current,
                patPageSize: size,
            }, () => {
                // 重新调用查询方法
                this.queryAdmList();
            });
        } else {
            this.setState({
                page: current,
                pageSize: size,
            }, () => {
                // 重新调用查询方法
                this.handleQuery();
            });
        }

    }


    //退费原因
    reasonsRefund = () => {
        var data = {
            params: [{
                "typeCode": "RefundInv"
            }]
        }

        $http.post('urlS', this, {
            code: "05210011",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    this.setState({
                        reasonsRefundData: res.reason,  // 退费原因
                    });
                }
            }
        });
    }

    // 权限
    initJuris = () => {
        let depositType = ""

        if (this.props.typeCinFlage && this.props.typeCinFlage === "I") {
            depositType = "I"
            this.setState({
                depositType: "I",
            })
        }

        let data = {
            params: [{
                logonHospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
                logonGroupID: JSON.parse(window.sessionStorage.userData).groupID,  //角色id
                logonUserID: JSON.parse(window.sessionStorage.userData).userID, //人员id
                invTypeCode: depositType != '' ? "IP" : this.props.location && this.props.location.state && this.props.location.state.depositType === 'I' ? 'IP' : 'OP',   // 类型
            }]
        }
        $http.post('urlS', this, {
            code: "05210001",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    let defaultPurpose = "";
                    if (res.accPurpose) {
                        res.accPurpose.map(item => {
                            if (item.id == res.accPurposeDefID) {
                                defaultPurpose = item.code;
                            }
                        })
                    }
                    this.setState({
                        otherPayData: res.groupConfig.HBOPConfigPaymode[0].OPPre || [],  // 其他付款方式
                        invoice: res.currentInvNoInfo,  // 发票号
                        // accPurpose: res.accPurpose || [],
                        accPurposeCode: defaultPurpose,
                    });
                    if (res.groupConfig.IfChargeFlag === 'Y') {
                        if (res.groupConfig.IfInvNo === 'Y' && res.currentInvNoInfo.split('^')[0] !== '0') {
                            message.error('该收费员无发票号')
                        }
                    } else {
                        message.error('无收费权限')
                        this.setState({
                            disabledInput: true,  // 收费权限
                        });
                    }

                }
            }
        });
    }

    // 读卡 --- 根据卡号取病人信息
    handleReadCard = (value, event) => {
        let { readModeI, readModeR, cardType } = this.state
        if (event.keyCode) {
            if (readModeI) {
                this.searchUser('cardNo'); // 重新调用查询接口
            }
            return false
        }
        if (readModeR) {
            this.readCard.ReadCard(cardType, "R", (json) => {
                let patNo = json && json.patInfo ? json.patInfo.patNo : ''
                this.setState({ patNo , cardNo: json.cardNo }, () => {

                    //this.searchUser('cardNo'); // 重新调用查询接口
                    if (patNo)
                    {
                        this.searchUser('patNo'); // 重新调用查询接口
                    }else{
                        this.searchUser('cardNo'); // 重新调用查询接口
                    }
                })
            })
        }

    }

    // // 回车读卡 --- 根据卡号取病人信息
    // handleReadCarddownE = (e, type) => {
    //     if (e.keyCode === 13) {

    //         this.searchUser('cardNo') // 读卡 --- 根据卡号取病人信息
    //     }
    // }


    // 读卡
    searchUser = (type) => {
        var data;
        let that = this;
        let { cardType, cardNo, patNo, cardTypeData } = this.state
        if (!type) {   // 查询全部
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": cardType,   //卡类型id
                    "cardNo": cardNo,    //卡号
                }]
            }
        }

        if (type === 'patNo') {
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": "",   //卡类型id
                    "cardNo": "",    //卡号
                }]
            }

            if (patNo === '') {
                return false
            }
        }

        if (type === 'cardNo') {
            data = {
                params: [{
                    "number": '', // 登记号/身份证号
                    "cardTypeID": cardType || '',     //卡类型id
                    "cardNo": cardNo || '', //卡号
                }]
            }

            if (cardNo === '') {
                return false
            }
            if (cardType === '') {
                message.error('请选择卡类型')
                return false
            }

            let cardTypeFilter = cardTypeData.filter(function (item) {
                return item.id == cardType;
            })

            let zeroLength = cardTypeFilter[0].cardLength

            if (zeroLength && zeroLength != '' && parseFloat(zeroLength) != 0) {
                this.setState({
                    cardNo: ArraySome.addPreZero(cardNo, zeroLength)
                })
                data = {
                    params: [{
                        "number": '', // 登记号/身份证号
                        "cardTypeID": cardType || '',     //卡类型id
                        "cardNo": ArraySome.addPreZero(cardNo, zeroLength) || '', //卡号
                    }]
                }
            }
        }



        $http.post('urlS', this, {
            code: "03040004",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {

                    that.setState({
                        userInfo: res.data || [],  // 用户数据
                        subAccManagementID: res.data.accTSubID || '',
                        accmanID: res.data.accTSubID.split('||')[0],//账户ID
                        patID: res.data.patID || '',						//Pat_Dr 病人ID
                        accTSubID: res.data.accTSubID || '',
                    }, () => {
                        that.queryAdmList();
                    });

                }
            }
        });
    }

    queryAdmList = () => {
        let { cardType, cardNo, patNo } = this.state
        let data = {
            params: [{
                "number": patNo || '', // 登记号/身份证号
                "cardTypeID": cardType,   //卡类型id
                "cardNo": cardNo,    //卡号
                hospID: JSON.parse(window.sessionStorage.userData).hospID,
            }],

        }
        $http.post('urlS', this, {
            code: "05300013",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    this.setState({
                        admList: res.data,
                        patTotal: res.total,
                    })
                }
            }
        });
    }
    // 回车查询登记号
    patNodownE = (e, type) => {
        if (e.keyCode === 13) {
            this.searchUser(type)
        }
    }

    // 调用公共组件的连接事件
    onRef = (ref) => {
        this.child = ref
    }

    //卡类型
    cardTypeList = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }

        $http.post('urlS', this, {
            code: "01040059",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    let cardDeffault = res.cardType.filter((item) => {
                        return item.defaultFlag === 'Y';
                    })
                    this.setState({
                        cardType: cardDeffault[0].id, // 默认卡
                        cardTypeData: res.cardType,  // 用户数据

                    }, () => {
                        this.CardTypeChange(this.state.cardType)
                    });
                }
            }
        });
    }

    // 查询条件 --- 类型·
    cardType = (e) => {
        this.setState({ cardType: e }, () => {
            this.CardTypeChange(e)
        });
    }
    // 查询条件 --- 卡号
    cardNo = (e) => {
        let { readModeI } = this.state
        if (!readModeI) {
            return false
        }
        this.setState({ cardNo: e.target.value });
    }

    // Card
    CardTypeChange = (e) => {
        if (!e) {
            return false
        }
        let { cardTypeData } = this.state
        let readMode = cardTypeData.filter((item, i) => {
            return item.id == e;
        })

        switch (readMode[0] && readMode[0].readMode) {
            // 只可input
            case 'I':
                this.setState({
                    readModeI: true,
                    readModeR: false,
                    cardNo: "",

                })
                break;
            // 只可读卡
            case 'R':
                this.setState({
                    readModeR: true,
                    readModeI: false,
                    cardNo: "",
                })
                break;
            // 皆可
            default:
                this.setState({
                    readModeI: true,
                    readModeR: true,
                    cardNo: "",
                })
                break;
        }

    }

    // 查询条件 --- 登记号
    patNo = (e) => {
        this.setState({ patNo: e.target.value });
    }

    // 查询条件 --- 操作类型
    doType = (e) => {
        this.setState({ findFlag: e }, () => {
            this.handleQuery() //查询
        });

    }

    // 提交 充值金额
    rechargeMoney = (e) => {
        this.setState({ rechargeMoney: Keup.MoneyReplace(e.target.value), rechargeReceipts: Keup.MoneyReplace(e.target.value) });
    }

    // 提交 备注
    rechargeMark = (e) => {
        this.setState({ rechargeMark: e.target.value });
    }
    // 提交 实收
    rechargeReceipts = (e) => {
        let val = Keup.MoneyReplace(e.target.value)
        let { rechargeMoney } = this.state
        this.setState({ rechargeReceipts: val });

        if (parseFloat(Keup.MoneyReplace(val)) > parseFloat(rechargeMoney)) {
            this.setState({
                rechargeGive: parseFloat(parseFloat(Keup.MoneyReplace(val)) - parseFloat(rechargeMoney)).toFixed(2)// 找零
            })

        } else {
            this.setState({
                rechargeGive: '0.00', // 找零
            })
        }
    }

    // 提交 退款金额
    refundAmount = (e) => {
        let val = Keup.MoneyReplace(e.target.value)
        let { purposeBlance } = this.state
        if (!purposeBlance) {
            message.error('请先选择用途')
            return false
        }
        if (parseFloat(Keup.MoneyReplace(val)) > parseFloat(purposeBlance)) {
            message.error('申请退款金额不能大于可退金额')
            return false
        }

        if (parseFloat(Keup.MoneyReplace(val)) < parseFloat(purposeBlance)) {
            this.setState({
                refundGive: parseFloat(parseFloat(purposeBlance) - parseFloat(Keup.MoneyReplace(val))).toFixed(2)    // 退款找零
            })

        } else {
            this.setState({
                refundGive: '0.00', // 退款找零
            })
        }

        this.setState({ refundAmount: val });
    }

    // 梭哈全部退款
    whole = () => {
        let { accAbleReturn } = this.state
        this.setState({ refundAmount: accAbleReturn, refundGive: '0.00', });

    }

    // 提交 退款渠道
    refundChannel = (e) => {
        this.setState({ refundChannel: e });
    }

    //  退费原因
    reasonsRefundType = (e) => {
        this.setState({ reasonsRefundType: e });
    }

    //  退费备注
    refundRemarks = (e) => {
        this.setState({ refundRemarks: e.target.value });
    }

    // 查询
    handleQuery = () => {
        let { patPage, patPageSize, subAccManagementID, findFlag, startDate, endDate, admID } = this.state;
        // if ((!subAccManagementID || subAccManagementID === '') && (patNo === '' || !patNo)) {
        //     message.error('请输入查询内容')
        //     return false
        // }
        if (admID == "") return;
        let data = {
            params: [{
                subAccManagementID: subAccManagementID,
                findFlag: findFlag,
                startDate: startDate,
                endDate: endDate,
                admID: admID,
            }],
            pagination: [{
                pageSize: patPage,
                currentPage: patPageSize,
            }]
        };
        $http.post('urlS', this, {
            code: "05210019",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    for (var i = 0; i < res.accDPInfo.length; i++) {
                        res.accDPInfo[i].key = i;
                    }
                    this.setState({
                        tableData: res.accDPInfo,
                        total: res.totalCount,
                        accDPAllPayAmt: res.accDPAllPayAmt.toFixed(2),
                        accAbleReturn: res.accAbleReturn.toFixed(2),
                        accBlance: res.accBlance.toFixed(2),
                        accStatusDesc: res.accStatusDesc,
                        rechargeMoney: res.rechargeMoney && res.rechargeMoney || "0.00",
                        reMDefault: res.rechargeMoney && res.rechargeMoney || "",//默认推荐预交金
                    })
                } else {
                    this.setState({
                        tableData: [],
                        total: 0
                    })
                }
            }
        });
        // 数据加载成功关闭loading
        //this.child.handleLoading()
    }


    // 时间
    onChangeTime = (date, dateString) => {
        this.setState({
            startDate: dateString[0],    //开始日期
            endDate: dateString[1],  //结束日期
        })

    }

    startChange(date) {
        this.setState({
            startDate: date,
        })
    }

    endChange(date) {
        this.setState({
            endDate: date,
        })
    }

    //密码设置二次弹框加载
    changeModalType(e) {
        this.setState({
            modalType: e,
            originaPassword: '',
            confirmPassword: '', //输入确认密码
            newPassword: '', //输入新密码
            IsSame: false, //是否显示新密码与确认密码一致信息标志
        })
    }

    //弹框打开
    modal = (type) => {
        let { modalPayTitle } = this.state
        if (((!this.state.admID || this.state.admID === '')) && ((type == 0) || (type == 3))) {
            message.error(this.state.languageCode === "CN" ? '请选择就诊' : 'No Adm Data')
            return false
        }
        if (!this.state.patID || this.state.patID === '') {
            message.error(this.state.languageCode === "CN" ? '无病人数据' : 'No Patient Data')
            return false
        }
        // 未执行完
        switch (type) {
            case '0':
                modalPayTitle = this.state.languageCode === "CN" ? '充值' : "Charge"
                break;
            case '1':
                modalPayTitle = this.state.languageCode === "CN" ? '请确认病人身份，选择设置类型' : "Please confirm the patient's identity and choose the type of setting"
                break;
            case '2':
                modalPayTitle = this.state.languageCode === "CN" ? '补打凭条' : "Reprint the receipt"
                break;
            case '3':
                modalPayTitle = this.state.languageCode === "CN" ? '设置退款金额' : "Set refund amount"
                break;
            case '4':
                modalPayTitle = this.state.languageCode === "CN" ? '确认取消冻结' : "Confirm unfreeze"
                break;
            default:
                break;
        }

        this.setState({
            modalShow: true,
            payButtonNum: 1,
            modalPayTitle,
            // modalPayTitle: this.state.languageCode === "CN" ? '身份验证' : 'Authentication',
            modalType: type
        })
        // , () => {
        //     // 渲染速度慢 无法按时准确识别this指向属性 加个延时器
        //     setTimeout(() => {
        //         this.setInputFocus(this.pwd);   // 获取光标
        //     }, 100);
        //     if (this.state.accPurposeCode != "") {
        //         this.accPurpose(this.state.accPurposeCode);
        //     }
        // })
    }

    //弹框取消
    handleCancel = () => {
        this.clearn() // 清空
    }

    // 清空
    clearn = () => {
        this.props.form.resetFields();
        this.setState({
            modalShow: false,
            modalShowNumber: false,
            // payButtonNum: 0,
            modalType: '',
            rechargeMoney: this.state.reMDefault && this.state.reMDefault || '0.00', //缴款金额 缴款金额
            rechargeReceipts: '0.00', // 实收
            rechargeGive: '0.00', // 找零
            payotherID: '', //支付方式ID 充值
            rechargeMark: '',  //备注 保存备注信息(支票号、银行卡(号)等) 充值
            refundAmount: '',// 提交 退款金额
            refundChannel: '', // 提交 退款渠道
            refundRemarks: '', //  退费备注
            refundGive: '0.00', // 退款找零
            // endDate: undefined,
            // startDate: undefined,
            readModeI: true,
            readModeR: true,
        })
    }

    //新密码输入框改变
    onChangeNewPassword = (event) => {
        this.setState({
            newPassword: event.target.value
        })
        if (this.state.confirmPassword !== event.target.value) {
            this.setState({
                IsSame: true
            })
        } else {
            this.setState({
                IsSame: false
            })
        }
    }
    //确认密码输入框改变判断与新密码是否一致
    onChangeConfirmPassword = (event) => {
        this.setState({
            confirmPassword: event.target.value
        })
        if (this.state.newPassword !== event.target.value) {
            this.setState({
                IsSame: true
            })
        } else {
            this.setState({
                IsSame: false
            })
        }
    }

    //弹框确认
    payButtonOk = () => {
        let { accTSubID, payButtonNum, depositType, accmanID, patID, refundRemarks, refundChannel, refundAmount, modalPayTitle, modalType, payotherID, rechargeMoney, rechargeMark, reasonsRefundType, rechargeReceipts, rechargeGive, ifAdmFlag, admID } = this.state
        let data = {};
        if (!rechargeMoney || rechargeMoney === '') {
            message.error('充值金额不正确！')
            return false
        }
        if (payButtonNum === 0) {
            // 未执行完
            switch (modalType) {
                case '0':
                    modalPayTitle = this.state.languageCode === "CN" ? '充值' : "Charge"
                    break;
                case '1':
                    modalPayTitle = this.state.languageCode === "CN" ? '请确认病人身份，选择设置类型' : "Please confirm the patient's identity and choose the type of setting"
                    break;
                case '2':
                    modalPayTitle = this.state.languageCode === "CN" ? '补打凭条' : "Reprint the receipt"
                    break;
                case '3':
                    modalPayTitle = this.state.languageCode === "CN" ? '设置退款金额' : "Set refund amount"
                    break;
                case '4':
                    modalPayTitle = this.state.languageCode === "CN" ? '确认取消冻结' : "Confirm unfreeze"
                    break;
                default:
                    break;
            }
            this.setState({
                payButtonNum: payButtonNum + 1,
                modalPayTitle: modalPayTitle,
            }, () => {
                if (this.state.payButtonNum === 1 && this.state.modalType === '0') {
                    this.setInputFocus(this.money)
                }

                if (this.state.payButtonNum === 1 && this.state.modalType === '3') {
                    this.setInputFocus(this.tfei)
                }
            })
        } else {
            // 执行
            let that = this;
            switch (modalType) {
                case '0':
                    data = {
                        params: [{
                            depositType: depositType === '' ? 'O' : depositType,
                            accmanID: accmanID || '',							//账户ID
                            patID: patID || '',						//Pat_Dr 病人ID
                            paywID: payotherID || '',					       //支付方式ID
                            paymenttype: "P" || '',         //缴款类型 P 充值,R 退款,F 结算账户的退款(账户不再可用)
                            channel: depositType === 'I' ? 'IP' : 'OP', //缴款渠道 OP 门诊窗口充值、SM 自助机充值、IP住院预交金充值
                            payamt: rechargeMoney || '',							//缴款金额 缴款金额
                            remark: rechargeMark || '',        //备注 保存备注信息(支票号、银行卡(号)等)
                            purPose: this.state.accPurposeCode,
                            admID: ifAdmflag == 'Y' ? admID : '',
                        }]
                    };
                    if (modalType === '0' && parseFloat(rechargeReceipts) + parseFloat(rechargeGive) < parseFloat(rechargeMoney)) {
                        message.error(this.state.languageCode === "CN" ? '实付金额小于应付金额' : "The actual payment amount is less than the amount payable")
                        return false
                    }
                    if (parseFloat(refundAmount) === 0) {  //parseFloat(rechargeReceipts) === 0 ||

                        message.error(this.state.languageCode === "CN" ? '金额需要大于0元' : "The amount needs to be greater than zero")
                        return false
                    }
                    $http.post('urlADS', this, {
                        code: "05210020",
                        data: data,
                        success: function (res) {
                            let errorCode = res.errorCode;
                            if (+errorCode === 0) {
                                message.success(res.errorMessage)
                                that.handleCancel()  //弹框取消 
                                that.initJuris();
                                that.handleQuery() //查询
                                that.searchUser()  //查询
                                that.getPurposeBlance();
                                that.setState({
                                    accDID: res.accDID,
                                }, () => {
                                    that.print() //打印
                                })

                            }
                        }
                    });
                    break;
                case '1':
                    this.handleCancel()
                    break;
                case '2':

                    break;
                case '3':
                    data = {
                        params: [{
                            accmanID: accmanID || '',							//账户ID
                            patID: patID || '',						//Pat_Dr 病人ID
                            paywID: refundChannel || '',					       //支付方式ID
                            paymenttype: "R" || '',         //缴款类型 P 充值,R 退款,F 结算账户的退款(账户不再可用)
                            channel: 'OP' || '', //缴款渠道 OP 门诊窗口充值、SM 自助机充值、IP住院预交金充值
                            payamt: refundAmount || '',							//缴款金额 缴款金额
                            refundreason: reasonsRefundType || '',				//退款原因 退款原因 CB_Reason 表ID
                            remark: refundRemarks || '',        //备注 保存备注信息(支票号、银行卡(号)等)
                            purPose: this.state.accPurposeCode,
                            admID: this.state.ifAdmflag == 'Y' ? admID : '',
                        }]
                    };
                    if (modalType === '0' && parseFloat(rechargeReceipts) + parseFloat(rechargeGive) < parseFloat(rechargeMoney)) {
                        message.error(this.state.languageCode === "CN" ? '实付金额小于应付金额' : "The actual payment amount is less than the amount payable")
                        return false
                    }
                    if (parseFloat(refundAmount) === 0) {  //parseFloat(rechargeReceipts) === 0 ||

                        message.error(this.state.languageCode === "CN" ? '金额需要大于0元' : "The amount needs to be greater than zero")
                        return false
                    }
                    $http.post('urlADS', this, {
                        code: "05210020",
                        data: data,
                        success: function (res) {
                            let errorCode = res.errorCode;
                            if (+errorCode === 0) {
                                message.success(res.errorMessage)

                                that.handleCancel()  //弹框取消
                                that.handleQuery() //查询
                                that.searchUser()  //查询
                                that.getPurposeBlance();
                                that.initJuris()
                                that.setState({
                                    accDID: res.accDID,
                                }, () => {
                                    this.print() //打印
                                })

                            }
                        }
                    });
                    break;
                case '4':

                    break;
                case '5':
                    this.props.form.validateFields((err, values) => {
                        if (err || this.state.IsSame) {
                            return;
                        }
                        data = {
                            params: [{
                                patId: patID,
                                originaPassword: values.OriginaPassword,
                                newPassword: values.NewPassword,
                                confirmPassword: values.ConfirmPassword,
                                accTSubID: accTSubID,
                            }]
                        }
                        $http.post('urlADS', this, {
                            code: "05100266",
                            data: data,
                            success: function (res) {
                                if (+res.errorCode === 0) {
                                    message.success(res.errorMessage);
                                    that.props.form.resetFields();
                                    that.handleCancel()
                                }
                            }
                        })
                    })
                    break;
                case '6':
                    data = {
                        params: [{
                            patId: patID,
                            accTSubID: accTSubID,
                            hospID: JSON.parse(window.sessionStorage.userData).hospID,
                        }]
                    }
                    $http.post('urlADS', this, {
                        code: "05100267",
                        data: data,
                        success: function (res) {
                            if (+res.errorCode === 0) {
                                message.success(res.errorMessage);
                                this.handleCancel()
                            }
                        }
                    })
                    break;
                default:
                    break;
            }

        }

    }


    // table行样式
    setRowClassNameSelect = (record) => {
        return record.accDPID === this.state.accDID ? 'clickRowStyle' : '';
    }
    setRowClassNameSelectAdm = (record) => {
        return record.admID === this.state.admID ? 'clickRowStyle' : '';
    }

    // 历史记录
    historyModal = () => {
        this.setState({
            modalShowNumber: true,
        });
    }

    otherPay = (code) => {
        this.setState({
            payotherID: code,
        })
    }
    accPurpose = (code) => {
        let { accmanID } = this.state;
        this.setState({
            accPurposeCode: code,
            refundAmount: '',
            refundGive: '0.00',
        }, () => {
            var data = {
                params: [{
                    accmanID: accmanID,
                    puposeCode: code,
                }]
            }

            $http.post('urlADS', this, {
                code: "03040039",
                data: data,
                success: function (res) {
                    let errorCode = res.errorCode;
                    if (+errorCode === 0) {
                        this.setState({
                            purposeBlance: res.purposeBlance,
                        })
                    }
                }
            });
        })
    }
    // 打印
    print = () => {

        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID, //医院id 
                "groupID": JSON.parse(window.sessionStorage.userData).groupID,  //角色id
                "printType": "OP",
                "printTemplateCode": "",
                "accDIDStr": this.state.accDID,

            }]
        }

        $http.post('urlADS', this, {
            code: "05100153",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (+errorCode === 0) {
                    let dataArr = res.data
                    let template = res.template
                    dataArr.map((item, i) => {
                        $loadTemplate(template[i], item.toString());
                    })
                }
            }
        });
    }

    render() {
        let { language, languageCode } = this.state
        const { getFieldDecorator } = this.props.form;
        // 组件所需参数
        const param = {
            // 表头配置
            columns: this.columns,
            // 表格数据
            data: this.state.tableData,
            // 数据总条数
            total: this.state.total,
            // 数据页数
            page: this.state.page,
            x: 1800
        }
        return (

            <div style={{ width: '100%', height: '100%' }} className="accountManagementIP">
                <ReadCard ref={r => this.readCard = r} />
                <div className="header">
                    <TipHeader userInfo={this.state.userInfo} key={this.state.userInfo.patID + this.state.userInfo.accTSubID} />
                </div>
                <div className="table-operations condition">
                    <Row style={{ minHeight: '80px', paddingLeft: '24px' }}>
                        <Col span={24}>
                            <Select allowClear style={{ width: '100px', margin: '12px 15px 0 0' }} placeholder={languageCode === "CN" ? "请选择卡类型" : 'Select Card Type'} value={this.state.cardType} onChange={(event) => { this.cardType(event) }}  >
                                <Option value=''>{languageCode === "CN" ? "请选择" : 'Please Select'}</Option>
                                {this.state.cardTypeData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                            </Select>
                            <Search className={`search ${!this.state.readModeI ? 'disabled' : ''}`} style={{ width: '200px', margin: '12px 15px 0 0' }} allowClear placeholder={language.PatientAccountManagementreadCard && language.PatientAccountManagementreadCard.message} disabled={this.state.disabledInput} value={this.state.cardNo} enterButton={language.PatientAccountManagementreadCard && language.PatientAccountManagementreadCard.descripts} onChange={(event) => { this.cardNo(event) }} onSearch={this.handleReadCard} /> {/* onKeyUp={(e) => { this.handleReadCarddownE(e, 'cardNo'); }}*/}
                            {language.PatientAccountManagementpatientInfo && language.PatientAccountManagementpatientInfo.descripts}：<Input allowClear style={{ width: '200px', margin: '12px 15px 0 0' }} placeholder={language.PatientAccountManagementpatientInfo && language.PatientAccountManagementpatientInfo.message} className='input' value={this.state.patNo} onChange={(event) => { this.patNo(event) }} onKeyUp={(e) => { this.patNodownE(e, 'patNo'); }} />
                            {language.PatientAccountManagementoperateType && language.PatientAccountManagementoperateType.descripts}：<Select allowClear style={{ width: '150px', margin: '12px 15px 0 0' }} placeholder={language.PatientAccountManagementoperateType && language.PatientAccountManagementoperateType.message} value={this.state.findFlag} onChange={(event) => { this.doType(event) }}  >
                                <Option value='1'>{languageCode === "CN" ? "充值" : 'Recharge'}</Option>
                                <Option value='2'>{languageCode === "CN" ? "退款" : 'Refund'}</Option>
                                <Option value='3'>{languageCode === "CN" ? "消费" : 'Consumption'}</Option>
                                <Option value='4'>{languageCode === "CN" ? "全部" : 'All'}</Option>
                            </Select>
                            <span style={{ display: 'inline-block', margin: '12px 15px 0 0' }}>
                                <RangeDatePicker label={language.PatientAccountManagementoperateDate && language.PatientAccountManagementoperateDate.descripts + '：'}
                                    startDate={this.state.startDate} endDate={this.state.endDate}
                                    format='YYYY-MM-DD' width={280}
                                    startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} /></span>
                            <Button onClick={() => this.searchUser()} style={{ margin: '12px 15px 0 0', background: 'rgba(255,255,255,1)' }}>{language.PatientAccountManagementquery && language.PatientAccountManagementquery.descripts}</Button>
                        </Col>
                    </Row>
                </div>
                <Col span={8} className="leftTable">
                    <Table
                        style={{ height: store.getState().tableHeight.y + 10 + 'px' }}
                        dataSource={this.state.admList}
                        columns={this.state.patColumns}
                        className='TableA'
                        //rowClassName="editable-row"
                        pagination={false}
                        scroll={{ x: 300, y: store.getState().tableHeight.y }}
                        bordered
                        loading={this.state.loading}
                        onRow={(record) => {
                            return {
                                onClick: (event) => {
                                    this.setState({
                                        admID: record.admID
                                    }, () => {
                                        this.handleQuery() // 查询
                                    })
                                },
                            };
                        }}
                        rowClassName={this.setRowClassNameSelectAdm}
                    />
                    <CommonPagination size="small" current={this.state.patPage} total={this.state.patTotal} search='search'
                        onShowSizeChange={this.apponShowSizeChange.bind(this, "pat")} complete={true} dataSource={this.state.admList}
                        onChange={this.appPageChange.bind(this, "pat")} />
                </Col>
                <Col span={16} className="rightTable">
                    <div style={{ paddingLeft: '24px', lineHeight: '32px' }}>
                        <Row className='clearfix' >
                            <div style={{ float: 'left', color: 'rgb(66, 185, 131)', }}>
                                <span style={{ verticalAlign: 'bottom' }}>{languageCode === "CN" ? "累计充值" : 'Accumulated Recharge'}：￥{this.state.accDPAllPayAmt}</span>
                                <span style={{ marginLeft: '20px', verticalAlign: 'bottom' }}> {languageCode === "CN" ? "账户状态" : 'Account Status'}：{this.state.accStatusDesc}</span>
                                <span style={{ marginLeft: '20px', verticalAlign: 'bottom' }}>{language.PatientAccountManagementAdvance && language.PatientAccountManagementAdvance.descripts}:</span><span className='curP' style={{ color: '#1890FF', fontWeight: 'bold' }} onClick={() => { this.historyModal() }} > {this.state.invoice ? this.state.invoice.split('^')[2] : ''}</span>
                                <span style={{ marginLeft: '20px' }}>{language.PatientAccountManagementaccPurPose && language.PatientAccountManagementaccPurPose.descripts}：
                                    <Select style={{ width: '100px' }} allowClear placeholder={languageCode === "CN" ? '请选择' : 'Please Select'} value={this.state.accPurposeCode} onChange={(val, opt) => { this.onPurposeChange(val, opt) }}>
                                        {this.state.accPurpose.map(item => <Option title={item.descripts + '^' + item.code} key={item.id} value={item.code} ifAdmflag={item.ifAdmFlag} >{item.descripts}</Option>)}
                                    </Select>
                                </span>
                            </div>
                            <div style={{ float: 'right' }}>
                                <Button onClick={() => this.modal('0')} style={{ float: 'left', border: 'none', marginLeft: ' 20px', }}><i className="f1"></i>{language.PatientAccountManagementrecharge && language.PatientAccountManagementrecharge.descripts}</Button>
                                <Button onClick={() => this.modal('1')} style={{ float: 'left', border: 'none', marginLeft: ' 20px', }}>{language.PatientAccountManagementpasswordSet && language.PatientAccountManagementpasswordSet.descripts}</Button>
                                <Button onClick={() => this.print()} style={{ float: 'left', border: 'none', marginLeft: ' 20px', }} disabled={this.state.accDID === '' ? true : false} >{language.PatientAccountManagementprintedSlip && language.PatientAccountManagementprintedSlip.descripts}</Button>
                                <Button onClick={() => this.modal('3')} style={{ float: 'left', border: 'none', marginLeft: ' 20px', }}><i className="money1"></i>{language.PatientAccountManagementrefund && language.PatientAccountManagementrefund.descripts}</Button>
                                <Button onClick={() => this.modal('4')} style={{ float: 'left', border: 'none', marginLeft: ' 20px', }}>{language.PatientAccountManagementaccountFreeze && language.PatientAccountManagementaccountFreeze.descripts}</Button>
                            </div>
                        </Row>
                    </div>
                    <div style={{ padding: 24 }}>
                        {/* handelThis将夫组件的属性与方法给子组件访问 */}
                        {/* <PubilcTablePagination param={param} handelThis={this} onRef={this.onRef} /> */}
                        <Table
                            style={{ height: store.getState().tableHeight.y - 50 + 'px' }}
                            dataSource={this.state.tableData}
                            columns={this.state.columns}
                            className='TableA'
                            //rowClassName="editable-row"
                            pagination={false}
                            scroll={{ x: 300, y: store.getState().tableHeight.y }}
                            bordered
                            loading={this.state.loading}
                            onRow={(record) => {
                                return {
                                    onClick: (event) => {
                                        this.setState({
                                            accDID: record.accDPID
                                        })
                                    },
                                };
                            }}
                            rowClassName={this.setRowClassNameSelect}
                        />
                        <CommonPagination size="small" current={this.state.page} total={this.state.total} search='search'
                            onShowSizeChange={this.apponShowSizeChange} complete={true} dataSource={this.state.tableData}
                            onChange={this.appPageChange} />
                        <ColumnAuthoritysModel
                            clientWidth='900px'
                            compontName='PatientAccountManagement'
                            configType="C"
                            onRef={this.onColumnRef}
                            reloadData={this.tableList.bind(this, "PatientAccountManagement", "PatientAccountManagement", "columns")}
                        />
                    </div>
                </Col>
                {/* 设置发票号弹框 */}
                <Modal
                    visible={this.state.modalShowNumber}
                    title='设置预交金票据号'
                    onCancel={this.handleCancel}
                    onOk={this.handleCancel}
                    width='600px'
                    footer={null}
                >
                    {/* <HistoryModal userInfo={this.state.userInfo} updateParent={this.updateParent}></HistoryModal> */}
                    <HopNumber invTypeCode='OP' key={this.state.invoice} handleCancel={this.handleCancel} handelThis={this} />

                </Modal>

                {/* 弹框 */}
                <Modal
                    visible={this.state.modalShow}
                    title={this.state.modalPayTitle}
                    onCancel={this.handleCancel}
                    onOk={this.payButtonOk}
                    className='modalPay'
                    width={this.state.modalWidth}
                >
                    <div style={{ display: this.state.payButtonNum === 0 ? 'block' : 'none' }}>
                        <Row >
                            <Col span={3} className='modalLabel' >{language.PatientAccountManagementpasswordCharge && language.PatientAccountManagementpasswordCharge.descripts}：</Col>
                            <Col span={21} ><Input ref={(input) => { this.pwd = input; }} allowClear placeholder={language.PatientAccountManagementpasswordCharge && language.PatientAccountManagementpasswordCharge.message} size="large" onPressEnter={this.payButtonOk} className='input' /></Col>
                        </Row>
                    </div>
                    <div style={{ display: this.state.payButtonNum === 1 && this.state.modalType === '0' ? 'block' : 'none' }}>
                        {/* 充值 */}
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementrechargeAmount && language.PatientAccountManagementrechargeAmount.descripts}：</Col>
                            <Col span={18} ><Input ref={(input) => { this.money = input; }}
                                onPressEnter={() => this.setInputFocus(this.typeMoney1)}
                                addonBefore="￥" allowClear
                                placeholder={language.PatientAccountManagementrechargeAmount && language.PatientAccountManagementrechargeAmount.message}
                                size="large" className='input'
                                value={this.state.rechargeMoney}
                                onChange={(event) => this.rechargeMoney(event)}
                                onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ rechargeMoney: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} /></Col>
                        </Row>
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementpaymentType && language.PatientAccountManagementpaymentType.descripts}：</Col>
                            <Col span={18} className='clearfix' >
                                {this.state.otherPayData.map((item, i) => <Col span={5} offset={1} className='mB10' > <Input ref={(input) => { i === 0 ? this.typeMoney1 = input : this.typeMoneyOuther = input }} onPressEnter={() => { this.setInputFocus(this.textArea), this.otherPay(item.paywID) }} readonly key={item.paywID} className={`payCode mR20 ${item.paywID === this.state.payotherID ? 'selected' : ''}`} onClick={() => this.otherPay(item.paywID)} value={item.paywDesc} ></Input></Col>)}
                            </Col>
                        </Row>
                        {/* <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementaccPurPose && language.PatientAccountManagementaccPurPose.descripts}：</Col>
                            <Col span={18} className='clearfix' >
                                {this.state.accPurpose.map((item, i) => {
                                    return <Col span={5} offset={1} className='mB10' > <Input ref={(input) => { i === 0 ? this.typeMoney1 = input : this.typeMoneyOuther = input }} onPressEnter={() => { this.setInputFocus(this.textArea), this.accPurpose(item.code) }} readonly key={item.id} className={`payCode mR20 ${item.code === this.state.accPurposeCode ? 'selected' : ''}`} onClick={() => this.accPurpose(item.code)} value={item.descripts} ></Input></Col>
                                })}
                            </Col>
                        </Row> */}
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementremarks && language.PatientAccountManagementremarks.descripts}：</Col>
                            <Col span={18} ><Input ref={(input) => { this.textArea = input; }} onPressEnter={this.payButtonOk} placeholder={language.PatientAccountManagementremarks && language.PatientAccountManagementremarks.message} size="large" className='input' rows={2} value={this.state.rechargeMark} onChange={(event) => this.rechargeMark(event)} /></Col>
                        </Row>
                        {/* <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementactualHarvest && language.PatientAccountManagementactualHarvest.descripts}：</Col>
                            <Col span={18} ><Input ref={(input) => { this.shimoney = input; }} onPressEnter={this.payButtonOk} addonBefore="￥" allowClear placeholder={language.PatientAccountManagementactualHarvest && language.PatientAccountManagementactualHarvest.message} size="large" className='input' value={this.state.rechargeReceipts} onChange={(event) => this.rechargeReceipts(event)} onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ rechargeReceipts: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} /></Col>
                        </Row>
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementchange && language.PatientAccountManagementchange.descripts}：</Col>
                            <Col span={18} ><Input addonBefore="￥" allowClear placeholder="找零" size="large" className='input' value={this.state.rechargeGive} disabled /></Col>
                        </Row> */}
                    </div>
                    <div style={{ display: this.state.payButtonNum === 1 && this.state.modalType === '1' ? 'block' : 'none' }}>
                        {/* 密码设置选择 */}
                        <Row span={24} className='mB20' style={{ background: 'rgb(240, 242, 245)', }}>
                            <TipHeader userInfo={this.state.userInfo} key={this.state.userInfo.patID + this.state.userInfo.accTSubID} />
                        </Row>
                        <Row span={24} className='mB20' >
                            <Button onClick={() => this.changeModalType('5')} style={{ float: 'left', width: '100%', }}>{language.PatientAccountManagementchangePassword && language.PatientAccountManagementchangePassword.descripts}</Button>
                        </Row>
                        <Row span={24} className='mB20' >
                            <Button onClick={() => this.changeModalType('6')} style={{ float: 'left', width: '100%', }}>{language.PatientAccountManagementresetPassword && language.PatientAccountManagementresetPassword.descripts}</Button>
                        </Row>
                    </div>
                    <div style={{ display: this.state.payButtonNum === 1 && this.state.modalType === '5' ? 'block' : 'none' }}>
                        {/* 修改密码 */}
                        <Form layout="inline">
                            <Row span={24}>
                                <Form.Item label={language.PatientAccountManagementoriginalPassword && language.PatientAccountManagementoriginalPassword.descripts} {...formItemLayout} style={{ width: '100%' }}>
                                    {getFieldDecorator("OriginaPassword", {
                                        initialValue: this.state.originaPassword,
                                        rules: [{ required: true, message: languageCode === "CN" ? '原密码不能为空' : 'The original password cannot be empty', }]
                                    })(
                                        <Input type="password" allowClear maxLength={6} placeholder={language.PatientAccountManagementoriginalPassword && language.PatientAccountManagementoriginalPassword.message} className='input' />
                                    )}
                                </Form.Item>
                            </Row>
                            <Row span={24}>
                                <Form.Item label={language.PatientAccountManagementnewPassword && language.PatientAccountManagementnewPassword.descripts} {...formItemLayout} style={{ width: '100%' }} >
                                    {getFieldDecorator("NewPassword", {
                                        initialValue: this.state.newPassword,
                                        rules: [{ required: true, message: languageCode === "CN" ? '新密码不能为空' : 'New password cannot be empty' }]
                                    })(
                                        <Input type="password" onChange={(event) => this.onChangeNewPassword(event)} allowClear maxLength={6} placeholder={language.PatientAccountManagementnewPassword && language.PatientAccountManagementnewPassword.message} className='input' />)}
                                </Form.Item>
                            </Row>
                            <Row span={24}>
                                <Form.Item label={language.PatientAccountManagementconfirmPassword && language.PatientAccountManagementconfirmPassword.descripts} {...formItemLayout} style={{ width: '100%' }} >
                                    {getFieldDecorator("ConfirmPassword", {
                                        initialValue: this.state.confirmPassword,
                                        rules: [{ required: true, message: languageCode === "CN" ? '确认密码不能为空' : 'Confirm password cannot be empty' }]
                                    })(
                                        <Input type="password" onChange={(event) => this.onChangeConfirmPassword(event)} allowClear maxLength={6} placeholder={language.PatientAccountManagementconfirmPassword && language.PatientAccountManagementconfirmPassword.message} className='input' />,

                                    )}
                                </Form.Item>
                                <p style={{ display: this.state.IsSame ? 'block' : 'none', color: '#f5222d', textAlign: 'center', }}>{languageCode === "CN" ? '确认密码与新密码不一致' : 'Confirm password is inconsistent with new password'}</p>
                            </Row>
                        </Form>
                    </div>
                    <div style={{ display: this.state.payButtonNum === 1 && this.state.modalType === '6' ? 'block' : 'none' }}>
                        {/* 重置密码 */}
                        <Row span={24} className='mB20' style={{ background: 'rgb(240, 242, 245)', }}>
                            <p>{languageCode === "CN" ? '请再次核对病人信息重置密码' : 'Please check the patient information reset password again'}</p>
                            <TipHeader userInfo={this.state.userInfo} key={this.state.userInfo.patID + this.state.userInfo.accTSubID} />
                        </Row>
                    </div>
                    <div style={{ display: this.state.payButtonNum === 1 && this.state.modalType === '3' ? 'block' : 'none' }}>
                        {/* 退款 */}
                        <Row span={24} className='mB20' style={{ background: 'rgb(240, 242, 245)', }}>
                            <TipHeader userInfo={this.state.userInfo} key={this.state.userInfo.patID + this.state.userInfo.accTSubID} />
                        </Row>
                        <Row span={24} className='mB20' >
                            <Col span={8} style={{ color: 'rgb(66, 185, 131)' }} >
                                {language.PatientAccountManagementbalance && language.PatientAccountManagementbalance.descripts}:{this.state.accBlance}
                            </Col>
                            <Col span={8} style={{ color: 'rgb(66, 185, 131)' }} >
                                用途金额:   <span style={{ color: this.state.purposeBlance ? '' : 'red' }}>{this.state.purposeBlance ? this.state.purposeBlance : 0}</span>
                            </Col>
                            <Col span={8} style={{ textAlign: 'right', color: 'rgb(66, 185, 131)' }} >
                                {language.PatientAccountManagementrefundable && language.PatientAccountManagementrefundable.descripts}:{this.state.purposeBlance ? this.state.purposeBlance : 0}
                            </Col>
                        </Row>
                        {/* <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementaccPurPose && language.PatientAccountManagementaccPurPose.descripts}：</Col>
                            <Col span={18} className='clearfix' >
                                {this.state.accPurpose.map((item, i) => {
                                    return <Col span={5} offset={1} className='mB10' > <Input ref={(input) => { i === 0 ? this.typeMoney1 = input : this.typeMoneyOuther = input }} onPressEnter={() => { this.setInputFocus(this.textArea), this.accPurpose(item.code) }} readonly key={item.id} className={`payCode mR20 ${item.code === this.state.accPurposeCode ? 'selected' : ''}`} onClick={() => this.accPurpose(item.code)} value={item.descripts} ></Input></Col>
                                })}
                            </Col>
                        </Row> */}
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementrequestRefund && language.PatientAccountManagementrequestRefund.descripts}:</Col>
                            <Col span={16} ><Input ref={(input) => { this.tfei = input; }} allowClear placeholder={language.PatientAccountManagementrequestRefund && language.PatientAccountManagementrequestRefund.message} size="large" className='input' value={this.state.refundAmount} onChange={(event) => this.refundAmount(event)} onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ refundAmount: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} /></Col>
                            <Col span={2} style={{ color: '#1890ff', lineHeight: '40px', textAlign: 'center', cursor: 'pointer', }} onClick={() => this.whole()} >全部</Col>
                            <Col span={16} offset={6} style={{ color: '#f5222d', display: this.state.refundGive === '0.00' ? 'none' : 'block' }} >
                                {language.PatientAccountManagementremain && language.PatientAccountManagementremain.descripts}:{this.state.refundGive}
                            </Col>
                        </Row>
                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementtefundChannel && language.PatientAccountManagementtefundChannel.descripts}：</Col>
                            <Col span={18} >
                                <Select onSelect={() => this.setInputFocus(this.tfeiNote)} allowClear style={{ width: '100%' }} size="large" placeholder={language.PatientAccountManagementtefundChannel && language.PatientAccountManagementtefundChannel.message} value={this.state.refundChannel} onChange={(event) => { this.refundChannel(event) }}  >
                                    <Option value=''>{languageCode === "CN" ? '请选择' : 'Please Select'}</Option>
                                    {this.state.otherPayData.map(item => <Option title={item.paywDesc + '^' + item.paywCode} key={item.paywID} value={item.paywID}  >{item.paywDesc}</Option>)}
                                </Select>
                            </Col>
                        </Row>

                        <Row className='mB20'>
                            <Col span={6} className='modalLabel' >{language.PatientAccountManagementremark && language.PatientAccountManagementremark.descripts}：</Col>
                            <Col span={18} ><Input ref={(input) => { this.tfeiNote = input; }} onPressEnter={this.payButtonOk} placeholder={language.PatientAccountManagementremark && language.PatientAccountManagementremark.message} size="large" className='input' rows={2} value={this.state.refundRemarks} onChange={(event) => { this.refundRemarks(event) }} /></Col>
                        </Row>
                    </div>
                </Modal>
            </div >


        )
    }
}

const PatientAccountManagementIPForm = Form.create()(PatientAccountManagementIP);
export default PatientAccountManagementIPForm;